using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Viettel.VOFFICE.DAO.Models.Mapping
{
    public class v_RoleControllerActionMappingMap : EntityTypeConfiguration<v_RoleControllerActionMapping>
    {
        public v_RoleControllerActionMappingMap()
        {
            // Primary Key
            this.HasKey(t => t.RoleColAcMapId);

            // Properties
            this.Property(t => t.ControllerName)
                .HasMaxLength(100);

            this.Property(t => t.ActionName)
                .HasMaxLength(100);

            this.Property(t => t.ControllerDisplayName)
                .HasMaxLength(255);

            this.Property(t => t.ActionDisplayName)
                .HasMaxLength(255);

            // Table & Column Mappings
            this.ToTable("v_RoleControllerActionMapping");
            this.Property(t => t.RoleColAcMapId).HasColumnName("RoleColAcMapId");
            this.Property(t => t.RoleId).HasColumnName("RoleId");
            this.Property(t => t.ControllerName).HasColumnName("ControllerName");
            this.Property(t => t.ActionName).HasColumnName("ActionName");
            this.Property(t => t.ControllerDisplayName).HasColumnName("ControllerDisplayName");
            this.Property(t => t.ActionDisplayName).HasColumnName("ActionDisplayName");
            this.Property(t => t.IsActive).HasColumnName("IsActive");
            this.Property(t => t.IsAccept).HasColumnName("IsAccept");
            this.Property(t => t.IsDenied).HasColumnName("IsDenied");

            // Relationships
            this.HasRequired(t => t.aspnet_Roles)
                .WithMany(t => t.v_RoleControllerActionMapping)
                .HasForeignKey(d => d.RoleId);

        }
    }
}
